package org.insightech.er.test;

import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.insightech.er.ERDiagramActivator;
import org.insightech.er.editor.model.dbimport.DBObject;
import org.insightech.er.editor.model.dbimport.DBObjectSet;
import org.insightech.er.editor.view.dialog.dbimport.SelectImportedObjectFromDBDialog;

public class SequenceTest {

    private final Display display = new Display();
    private final Shell shell = new Shell(display);

    public static void main(final String[] args) throws Exception {
        new ERDiagramActivator();
        new SequenceTest();
    }

    public SequenceTest() {
        initialize(shell);

        // shell.open();
        // while (!shell.isDisposed()) {
        // if (!display.readAndDispatch())
        // display.sleep();
        // }
        // display.dispose();
    }

    private void initialize(final Composite parent) {
        final DBObjectSet dbObjects = new DBObjectSet();
        dbObjects.add(new DBObject("schema", "a", DBObject.TYPE_TABLE));
        dbObjects.add(new DBObject("schema", "b", DBObject.TYPE_TABLE));
        dbObjects.add(new DBObject("schema", "c", DBObject.TYPE_TABLE));
        dbObjects.add(new DBObject("schema", "a", DBObject.TYPE_SEQUENCE));
        dbObjects.add(new DBObject("schema", "b", DBObject.TYPE_SEQUENCE));
        dbObjects.add(new DBObject("schema", "c", DBObject.TYPE_SEQUENCE));
        dbObjects.add(new DBObject("schema", "a", DBObject.TYPE_VIEW));
        dbObjects.add(new DBObject("schema", "b", DBObject.TYPE_VIEW));
        dbObjects.add(new DBObject("schema", "c", DBObject.TYPE_VIEW));

        final SelectImportedObjectFromDBDialog dialog = new SelectImportedObjectFromDBDialog(shell, null, dbObjects, null);

        dialog.open();
    }

}
